package com.example.demo.dao;

import com.example.demo.model.Articleinfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {

    // 通过uid查询文章表 按照desc排序
    @Select("select * from articleinfo where uid=#{uid} order by id desc" )
    List<Articleinfo> getListByUid(@Param("uid") int uid);

    // 删除文章操纵
    @Delete("delete from articleinfo where id=#{aid} and uid=#{uid}")
    int del(@Param("aid") Integer aid,int uid);

    // 新增文章操作
    @Insert("insert into articleinfo(title,content,uid) values(#{title},#{content},#{uid})")
    int add(Articleinfo articleinfo);
}
